using UnityEngine;

public class FlyWindow : BaseWindow
{
	public static FlyWindow instance;

	public UIJoystick joystick;

	public GameObject anchorLeft;

	public GameObject anchorRight;

	public GameObject anchorCenter;

	public GameObject interfaceForHelicopterWithWeapon;

	public GameObject labelBullet;

	public GameObject buttonShoot;

	public UISlider healthBar;

	public UILabel lbCountHelicopterBullets;

	[HideInInspector]
	public EntityBehavior vehicle;

	public ReloadingUI reloadingUI;

	public int countHelicopterBullets
	{
		set
		{
			if (lbCountHelicopterBullets != null)
			{
				lbCountHelicopterBullets.text = string.Empty + value;
			}
		}
	}

	private void Awake()
	{
		instance = this;
	}

	private void OnDestroy()
	{
		instance = null;
	}

	private void OnEnable()
	{
	}

	private void OnDisable()
	{
	}

	private void Update()
	{
		if (vehicle != null)
		{
			float num = (float)vehicle.health / (float)vehicle.maxHealth;
			if (healthBar.value != num)
			{
				healthBar.value = num;
			}
		}
	}

	public override void OnPreShow(object userData)
	{
		anchorLeft.SetActive(true);
		anchorRight.SetActive(true);
		anchorCenter.SetActive(true);
	}

	public override void OnHide()
	{
		anchorLeft.SetActive(false);
		anchorRight.SetActive(false);
		anchorCenter.SetActive(false);
	}

	public void SetWeaponVisible(bool value)
	{
		interfaceForHelicopterWithWeapon.SetActive(value);
		labelBullet.SetActive(value);
		buttonShoot.SetActive(value);
	}
}
